package cn.springcloud.fix.consumer.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Slf4j
@RestController
@RequestMapping("user")
public class UserController {

    @GetMapping("addUser")
    public String addUser() {
        return "添加用户成功：" + new Date().getTime();
    }

    @GetMapping("deleteUser/{uid}")
    public String deleteUser(@PathVariable(name = "uid") Integer uid) {
        return "删除用户成功：uid=" + uid;
    }

    @GetMapping("updateUser")
    public String updateUser() {
        return "修改用户成功：" + new Date().getTime();
    }

    @PreAuthorize("@pms.hasPermission('sys_dept_add')")
    @GetMapping("findAllUsers")
    public String findAllUsers() {
        return "查询用户成功：" + new Date().getTime();
    }
}
